<?php
namespace App\Models;
use stdClass;
class PowerModel extends BaseModel {
	public function __construct() {
		parent::__construct();
		$this -> _table = "power";
	}
	
	public function Powerselect($rolename){
		$sql=
		"select power.ID,PowerName,ControllerAction from role
		INNER JOIN rolepower ON rolepower.Roleid = role.ID
		INNER JOIN power ON rolepower.power = power.id
		WHERE  RoleName = '" . $rolename . "'";
		
		$sth = $this -> _dbHandle -> prepare($sql);
		$sth -> execute();
		return $result= $sth -> fetchAll(); 
	}
}
